<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>充值</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
    <script type="text/javascript">
        function closeFrame(){
         api.setFrameGroupIndex({
            name: 'nav',
            index: 2,
            reload: true,
        });
         var setSele = 'changeSelect();';
         api.execScript({
            name: 'home',
            script: setSele,
        });

         api.closeFrame({
            name: 'recharge-top'
        });

         api.closeFrame({
             name: 'sh_bank_recharge'
         });
     };
 </script>
</head>
<body>
 <!-- 头部 -->
 <!--  <header class="aui-bar aui-bar-nav" id="topbar">充值</header> -->
<!--  <header class="aui-bar aui-bar-nav" id="topbar">
    <a class="aui-pull-left aui-btn" onclick="closeFrame()">
        <span class="aui-iconfont aui-icon-left"></span>
    </a>
    <div class="aui-title">充值</div>
</header> -->

<!--     <div class="sh-bank-t">
        <div class="sh-bank-t-t">
            <i class="CCB"></i>
            <h3>建设银行</h3>
            <p>
                快捷<span>支付</span>
            </p>
        </div>
        <div class="sh-bank-t-m">
            <ul class="aui-row">
                <li class="aui-col-xs-3">****</li>
                <li class="aui-col-xs-3">****</li>
                <li class="aui-col-xs-3">****</li>
                <li class="aui-col-xs-3">5623</li>
            </ul>
        </div>
        <div class="sh-bank-t-d">单笔限额5万元，单卡单日累计限额5万元</div>
    </div> -->
    <form id="rechargeForm" action="http://www.big-wealth.com/index.php?ctl=hrb&act=netSave" method="post">
        <div class="sh-bank-d">
            <h3>可用余额(元) : <span id="money"></span></h3>
            <ul>
              <input type="hidden" name="agent" value="h5">
              <input type="hidden" name="userid" id="userid">
              <li>
                <div class="aui-col-xs-3">金额</div>
                <div class="aui-col-xs-5"><input type="tel" name="transAmt" id="moneyNum" placeholder="请填写充值金额" maxlength="12" style="height:auto;">
                    <div class="check" id="checkRecharge"></div>
                </div>
                <div class="aui-col-xs-4"></div>
            </li>
<!--             <li>
                <div class="aui-col-xs-3">验证码</div>
                <div class="aui-col-xs-5"><input type="text" placeholder="请填写短信验证码" maxlength="6"  onkeyup="checkCaptcha();" id="sms_code"></div>
                <div class="aui-col-xs-4"><input type="submit" value="获取验证码" onclick="sendCaptcha();" id="sendCodeBtn"></div>
                <div class="check" id="checkCaptcha"></div>
            </li> -->
        </ul>
        <div class="aui-btn aui-btn-success aui-btn-block aui-btn-sm" onclick="recharge()">确认</div>
        <p>您的充值资金将进入您的哈尔滨银行存管账户</p>
    </div>
</form>
</body>
<script type="text/javascript">
    apiready = function(){
      var user_id = $api.getStorage('userid');
      // 给用户id隐藏域赋值
      var userid = document.getElementById("userid");
      userid.value = user_id;
      // 可用余额
      var money = $api.getStorage('money');
      var moneyEle = document.getElementById("money");
      moneyEle.innerHTML = money;
  }

  function recharge(){

      var moneyEle = $api.byId('moneyNum');
      var moneyNum = moneyEle.value;
      // 充值金额不能为空
      if (!moneyNum) {
        $api.byId('checkRecharge').innerText = '充值金额不能为空';
        return false;
    }else{
        $api.byId('checkRecharge').innerText = '';
    }

      // 提交表单
      var form = document.getElementById("rechargeForm");

      form.submit();

      api.toast({
        msg: '正在前往哈行存管系统...',
        duration: 2000,
        location: 'middle'
    });
  }

    // // 发送验证码
    // function sendCaptcha(){

    //     // var mobile = $api.byId('mobile');
    //     // var mobileValue = mobile.value;

    //     checkMobile();
    // };

    // // 获取验证码
    // function checkMobile() {

    //     // 获取当前用户手机号码
    //     var mobileValue = $api.getStorage('mobile');
    //     // 手机号码符合要求后开始倒计时
    //     var time = 60;
    //     var sendCodeBtn = $api.byId('sendCodeBtn');
    //     var timer = setInterval(function(){    
    //         time--;
    //         // $api.removeCls(sendCodeBtn, 'active');
    //         sendCodeBtn.value = time + " 秒";
    //         sendCodeBtn.removeAttribute('onclick');
    //         if (time==0) {
    //           time = 60;
    //           clearInterval(timer); 
    //           // $api.addCls(sendCodeBtn, 'active');
    //           sendCodeBtn.value = "发送验证码";
    //           sendCodeBtn.setAttribute('onclick',"sendCaptcha();");
    //       }
    //   },1000);
    //     api.ajax({
    //         url: webAddress + '/index.php?ctl=app_user_center&act=get_register_verify_code_mobile',
    //         method: 'post',
    //         data: {
    //             values: { 
    //                 user_mobile: mobileValue,
    //             },
    //         }
    //     },function(ret, err){
    //         if (ret) {

    //             if (ret.status == 0) {
    //                 alert(ret.info);
    //                 return false;
    //             }else{
    //                 var captcha = ret.code;
    //                 captchaSend(mobileValue,captcha);
    //             }
    //         } else {

    //             alert(err.msg);
    //         }
    //     });
    // }

    // // 发送验证码
    // function captchaSend(mobileValue,captcha){
    //     alert(mobileValue);
    //     alert(captcha);
    //     // 将最终收到的验证码定义成全局变量
    //     lastCaptcha = captcha;
    //     api.ajax({
    //         url: webAddress + '/sendmsg/SendTemplateSMS.php',
    //         method: 'post',
    //         data: {
    //             values: { 
    //                 mobile: mobileValue,
    //                 code: captcha,
    //             },
    //         }
    //     },function(ret, err){
    //         if (ret) {
    //         } else {
    //             // 逻辑在这里写
    //             var sms_code = $api.byId('sms_code');
    //             sms_code.focus();
    //         }
    //     });
    // };

    // // 校验验证码
    // function checkCaptcha(){

    //     var sms_codeEle = $api.byId('sms_code');
    //     var sms_codeValue = sms_code.value;
    //     var sms_codeLength = sms_codeValue.length;
    //     if (sms_codeLength == 6) {
    //         if (sms_codeValue == lastCaptcha) {
    //             $api.byId('checkCaptcha').innerText = '验证码正确';
    //         }else{
    //             $api.byId('checkCaptcha').innerText = '验证码错误';
    //         }
    //     }else{
    //         $api.byId('checkCaptcha').innerText = '验证码错误';
    //     }
    // }
</script>
</html>